<style>
    .panel-post {
        position: relative;
    }

    .btn-post {
        position: absolute;
        right: 0;
        bottom: 10px;
    }

    #post-form .panel-default {
        padding: 0;
    }
</style>
<style>
    .autocomplete-searchtitle {
        padding: 0px 8px;
        display: none;
    }

    .autocomplete-searchtitle .media {
        border-bottom: 1px solid #eee;
        margin-top: 10px;
        padding-bottom: 10px;
    }

    .autocomplete-searchtitle .media:last-child {
        border-bottom: 0;
    }

    .autocomplete-searchtitle .media:hover {
        background: #fefefe;
    }
</style>

<script type="text/html" id="headertpl">
    <div class="px-2">
        <div class="row">
            <div class="col-12">
                <div class="alert" style="border-radius: 0;color: #0084ff; background: rgba(0, 132, 255, 0.1);margin-bottom:0;">
                    为你找到以下几篇相似文章
                </div>
            </div>
        </div>
    </div>
</script>
<script type="text/html" id="itemtpl">
    <div class="media">
        <a class="" href="<%=item.url%>" target="_blank">
            <div class="media-left">
                <img src="<%=item.image%>" style="width: 50px; height: 50px;">
            </div>

            <div class="media-body">
                <h4 class="media-heading"><%=#replace(item.title)%></h4>
                <div class="text-muted">发布时间：<%=item.create_date%></div>
            </div>
        </a>
    </div>
</script>

<div class="container mt-20">
    <div id="content-container">
        <div class="row">
            <div class="col-md-3">
                {include file="common/sidenav" /}
            </div>
            <div class="col-md-9">
                <div class="panel panel-default panel-user">
                    <div class="panel-body">
                        {if $archives && $archives['status']=='normal'}
                        <div class="alert alert-danger-light">
                            <b>温馨提示：</b>当前{:$model?$model.name:'文章'}已经发布,如果修改将重新进入审核
                        </div>
                        {/if}
                        <div class="panel-post">
                            <h2 class="page-header">{:$archives?'修改':'发布'}{:$model?$model.name:'文章'}</h2>
                        </div>
                        <div class="row">
                            <div class="col-xs-12">
                                <form id="post-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
                                    {:token()}
                                    <div class="form-group">
                                        <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_id')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <select id="c-channel_id" data-rule="required" class="form-control selectpicker" data-live-search="true" name="row[channel_id]">
                                                {$channelOptions}
                                            </select>
                                        </div>
                                    </div>
                                    {if !$model || $model->iscontribute('channel_ids')}
                                    <div class="form-group" data-field="channel_ids">
                                        <label for="c-channel_id" class="control-label col-xs-12 col-sm-2">{:__('Channel_ids')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <select id="c-channel_ids" data-rule="" class="form-control selectpicker" multiple data-live-search="true" name="row[channel_ids][]">
                                                {$secondChannelOptions}
                                            </select>
                                        </div>
                                    </div>
                                    {/if}
                                    <div class="form-group">
                                        <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$archives.title|default=''|htmlentities}" data-suggestion-url="{:url('cms.archives/suggestion')}">
                                        </div>
                                    </div>
                                    {if !$model || $model->iscontribute('image')}
                                    <div class="form-group" data-field="image">
                                        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Image')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <div class="input-group">
                                                <input id="c-image" class="form-control" name="row[image]" type="text" value="{$archives.image|default=''|htmlentities}">
                                                <div class="input-group-addon no-border no-padding">
                                                    <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-preview-id="p-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                                                    <span class="msg-box n-right" for="c-image"></span>
                                                </div>
                                            </div>
                                            <ul class="row list-inline plupload-preview" id="p-image"></ul>
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('images')}
                                    <div class="form-group" data-field="images">
                                        <label for="c-images" class="control-label col-xs-12 col-sm-2">{:__('Images')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <div class="input-group">
                                                <input id="c-images" class="form-control" name="row[images]" type="text" value="{$archives.images|default=''|htmlentities}">
                                                <div class="input-group-addon no-border no-padding">
                                                    <span><button type="button" id="plupload-images" class="btn btn-danger plupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                                                    <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-preview-id="p-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                                                    <span class="msg-box n-right" for="c-images"></span>
                                                </div>
                                            </div>
                                            <ul class="row list-inline plupload-preview" id="p-images"></ul>
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('tags')}
                                    <div class="form-group" data-field="tags">
                                        <label for="c-tags" class="control-label col-xs-12 col-sm-2">{:__('Tags')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input id="c-tags" data-rule="" class="form-control" placeholder="多个标签请使用半角逗号分隔" data-primary-key="name" data-multiple="true" name="row[tags]" type="text" value="{$archives.tags|default=''|htmlentities}">
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('content')}
                                    <div class="form-group" data-field="content">
                                        <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <textarea id="c-content" data-rule="required" class="form-control editor" name="row[content]" rows="15">{$archives.content|default=''|htmlentities}</textarea>
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('price')}
                                    <div class="form-group" data-field="price">
                                        <label for="c-price" class="control-label col-xs-12 col-sm-2">{:__('Price')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input id="c-price" data-rule="" class="form-control" name="row[price]" type="number" value="{$archives.price|default='0'}">
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('outlink')}
                                    <div class="form-group" data-field="outlink">
                                        <label for="c-outlink" class="control-label col-xs-12 col-sm-2">{:__('Outlink')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input id="c-outlink" data-rule="" class="form-control" name="row[outlink]" type="text" value="{$archives.outlink|default=''|htmlentities}">
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('keywords')}
                                    <div class="form-group" data-field="keywords">
                                        <label for="c-keywords" class="control-label col-xs-12 col-sm-2">{:__('Keywords')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <input id="c-keywords" data-rule="" class="form-control" name="row[keywords]" type="text" value="{$archives.keywords|default=''|htmlentities}">
                                        </div>
                                    </div>
                                    {/if}
                                    {if !$model || $model->iscontribute('description')}
                                    <div class="form-group" data-field="description">
                                        <label for="c-description" class="control-label col-xs-12 col-sm-2">{:__('Description')}</label>
                                        <div class="col-xs-12 col-sm-8">
                                            <textarea id="c-description" cols="60" rows="5" data-rule="" class="form-control" name="row[description]">{$archives.description|default=''|htmlentities}</textarea>
                                        </div>
                                    </div>
                                    {/if}
                                    <div id="extend"></div>

                                    <div class="form-group normal-footer">
                                        <label class="control-label col-xs-12 col-sm-2"></label>
                                        <div class="col-xs-12 col-sm-8">
                                            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                                            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
